#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;

class Solution {
public:
    int takeAttendance(vector<int>& records) {
        int left = 0, right = records.size() - 1;
        while (left < right)
        {
            int mid = left + (right - left + 1) / 2;
            if (records[mid] == mid) left = mid;
            else right = mid - 1;
        }
        if (records[left] == left + 1) return left;
        return left + 1;
    }
};

int main()
{
    return 0;
}